package features.advance.jdk.jvm;

/**
 * @author LIN
 * @date 2021-07-13
 */
public class Foo {
    private static final int MAX_COUNT = 1000;
    private static int count = 0;
    public int bar() throws Exception{
        if (++count >= MAX_COUNT) {
            count = 0;
            throw new Exception("count overflow");
        }
        return count;
    }

    public void test(){
        int a = 1;
        int b = 2;

        int c = 3;

        int d = 4;

        int e = b + a + d;

        int f = 5;


    }

    public static void main(String[] args) throws InterruptedException {
        Byte[] b = new Byte[(49)  * 1024 * 1024];
        System.out.println(b);
        Thread.sleep(10000);
        Byte[] c = new Byte[(1)  * 1024 * 1024];


        for (int i = 0; condition(i) && i < 100; i++) {

        }
    }

    private static boolean condition(int i) {
        System.out.println("首次判断了"+i);
        return true;
    }
}
